package com.sohoappspot.sohosched.server.model;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.sohoappspot.sohosched.client.exception.NotLoggedInException;

public class ModelParams {
	/**
	 * A reference to the data store.
	 */
	protected static final Store store = new Store("transactions-optional");
	
	public static final Store getStore(){
		return store;
	}
	
	public static User getUser() {
		UserService userService = UserServiceFactory.getUserService();
		return userService.getCurrentUser();
	}
	
	public static void checkLoggedIn() throws NotLoggedInException {
		if (getUser() == null) {
			throw new NotLoggedInException("Not logged in.");
		}
	}
}
